﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using KPIS.DBM;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.DAL
{
    public class TestDAL
    {
        private IDBManager dbManager = new DBManager(SystemInfo._DataProvider, SystemInfo._ConnectionString);
        private _AutoDBM autoDbm;

        public TestDAL()
        {
            autoDbm = new _AutoDBM(ref dbManager);
        }

        public void InsertTest(object anyObj)
        {
            try
            {
                dbManager.Open();
                autoDbm.UpdateParameter(anyObj);
                string strSQL = autoDbm.GenerateSqlScript(_AutoDBM.ScriptType.Insert, anyObj);
                dbManager.ExecuteNonQuery(CommandType.Text, strSQL);
            }
            catch (Exception error)
            {
                throw;
            }
            finally
            {
                dbManager.CloseReader();
                dbManager.Dispose();
            }
        }
    }
}
